package com.zjgxzh.dialogservice.mapper;

import com.zjgxzh.dialogservice.pojo.Dialog;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DialogMapper {

    @Select("SELECT * FROM dialog WHERE thread_id = #{threadId}")
    List<Dialog> findDialogByThreadId(String threadId);

    @Insert("INSERT INTO dialog (thread_id, assistant_id, content, role, time, username) " +
            "VALUES (#{threadId},#{assistantId},#{content},#{role},#{time},#{username})")
    void addDialog(Dialog dialog);
}
